//
//  ChapterSQL.h
//  readNovels
//
//  Created by 吳瀾洲 on 2020/4/27.
//  Copyright © 2020 wulanzhou. All rights reserved.
//

#ifndef ChapterSQL_h
#define ChapterSQL_h

//章节sql操作

//新增
#define insert_chapter_sql  @"insert into chapter(catalog_id,title,content,finished,sort,memo,ctime,mtime) values(?,?,?,?,?,?,?,?)"

//更新
#define update_chapter_status   @"update chapter set finished = ?,mtime = ? where catalog_id = ?"
#define update_chapter_content  @"update chapter set content = ?,finished = ?,mtime = ? where catalog_id = ?"

//删除
#define delete_chapter_catalog_id   @"delete from chapter where catalog_id>=?"

//查询
#define query_all_chapter             @"select * from chapter order by sort asc"
#define query_finished_chapter        @"select * from chapter where finished = ?"
#define query_finished_book_chapter   @"select * from chapter where finished = ? and catalog_id in (select id from catalog where book_id=?)"
#define query_catalog_id_chapter      @"select * from chapter where catalog_id = ?"
#define query_book_id_chapter         @"select * from chapter where catalog_id in(SELECT id FROM catalog where book_id=?) order by sort"

#endif /* ChapterSQL_h */
